package sort;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class GoodsTest {
    public static void main(String[] args) {
        Goods g1=new Goods("s001","手机",4000);
        Goods g2=new Goods("s002","冰箱",7000);
        Goods g3=new Goods("s003","电脑",10000);
        Goods g4=new Goods("s004","电视",4000);
        List<Goods> goodsList=new ArrayList<Goods>();
        goodsList.add(g1);
        goodsList.add(g2);
        goodsList.add(g3);
        goodsList.add(g4);
        System.out.println("排序前:");
        for (Goods goods:goodsList){
            System.out.println(goods);
        }
        System.out.println("排序后:");
        Collections.sort(goodsList);
        for (Goods goods:goodsList){
            System.out.println(goods);
        }
    }
}
